import Vue from "vue";
import VueRouter from "vue-router";

import Home from "@/views/home.vue";
import Search from "@/views/search.vue";
import Setting from "@/views/setting.vue";
import Friends from "@/views/friends.vue";

import Article from "@/port/article.vue";
import Collect from "@/port/collect.vue";
import Like from "@/port/like.vue";
import User from "@/port/user.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/search",
    component: Search,
  },
  {
    path: "/setting",
    component: Setting,
  },
  {
    path: "/article/:id",
    component: Friends,
  },
  {
    path: "/",
    component: Home,
    redirect: "/article",
    children: [
      {
        path: "/article",
        component: Article,
      },
      {
        path: "/collect",
        component: Collect,
      },
      {
        path: "/like",
        component: Like,
      },
      {
        path: "/user",
        component: User,
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
